#include "ElementFactory.h"

#include "Utility/Logging/SGLogger.h"

#include "Quad9Element.h"
#include "Tri6Element.h"

using SG::FEMSolver::BeamElement::BeamSecElementFactory;
using SG::FEMSolver::BeamElement::ISectionElement;

// 根据单元类型创建基类指针
std::unique_ptr<ISectionElement> BeamSecElementFactory::Create (BeamSecElementTypes eleType)
{
    switch (eleType)
    {
    case ElementType_Q9: {
        auto q9 = std::make_unique<SG::FEMSolver::BeamElement::Quad9Element> ();
        q9->Initialize ();
        return q9;
    }
    case ElementType_T6: {
        auto t6 = std::make_unique<SG::FEMSolver::BeamElement::Tri6Element> ();
        t6->Initialize ();
        return t6;
    }
        // 新增单元仿照上面加case即可。

    default:
        SGFatal << " The type of the element is not supported: " << eleType;
        return nullptr;
    }
}